﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LDTB.Service;

namespace LDTB
{
    public partial class ExportReport : Form
    {

        LDTBDataDataContext ds = DataService.DB;

        public ExportReport()
        {
            InitializeComponent();
        }

        private void ExportReport_Load(object sender, EventArgs e)
        {
            List<Ward> ltward = new List<Ward>();
            ltward.Add(new Ward { ID = -1, WardName = "Tất cả" });
            var ward = from w in ds.Wards
                       select w;
            ltward.AddRange(ward.ToList());
            this.ddlWard.DataSource = ltward;
            this.ddlWard.ValueMember = "ID";
            this.ddlWard.DisplayMember = "WardName";



            List<CateObject> ltCate = new List<CateObject>();
            ltCate.Add(new CateObject { CatID = -1, CatName = "Tất cả" });
            var cats = from w in ds.CateObjects
                       select w;
            ltCate.AddRange(cats.ToList());
            this.ddlCate.DataSource = ltCate;
            this.ddlCate.ValueMember = "CatID";
            this.ddlCate.DisplayMember = "CatName";
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int wardid = int.Parse(ddlWard.SelectedValue.ToString());
            int catid = int.Parse(ddlCate.SelectedValue.ToString());

            ReportCenter rc = new ReportCenter();
            rc.ShowSimple(catid,wardid);
            rc.Show();

        }
    }
}
